package com.cskaoyan._03array._02test;

/**
 * @author Macro_Ray
 * @since 2024/3/5 0:06
 */

/*
 * 定义数组存入1 2 3 4 5，输出5 4 3 2 1 */
public class _01Traverse_03 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5};
        for (int i = 0, j = arr.length - 1;
             i < j;
             i++, j--) {
            int temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
















